{ Statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=2994
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var   
	i,n:longint;
	a:array[0..100010] of longint;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
a[1]:=2;
a[2]:=4;
a[3]:=7;
for i:=4 to n do
	a[i]:=a[i-1]+a[i-2]+a[i-3];
write(a[n]);
end.